<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<title>班级列表</title>
<c:import url="/WEB-INF/jsp/head.jsp" />
<link rel="stylesheet"
	href="static/css/bootstrap-datetimepicker.min.css">
<script type="text/javascript"
	src="static/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript"
	src="static/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="static/js/class/list.js"></script>
</head>
<body>
	<div class="default-theme container-fluid iframe">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">搜索条件</div>
				<div class="panel-body">
					<form class="form-inline" action="class/list" method="post">
						<div class="form-group">
							<label for="name">班级名称:</label> <input type="text"
								class="form-control" name="name" value="${nameValue }" />
						</div>
						<div class="form-group">
							<label for="product.id">产品类型：</label> <select name="product.id"
								class="form-control">
								<option value="">所有</option>
								<c:forEach items="#{products }" var="product">
									<option value="${product.id }"
										<c:if test="${productValue == product.id }">selected="selected"</c:if>>${product.name }</option>
								</c:forEach>
							</select>
						</div>
						<div class="form-group">
							<label for="status">班级状态：</label> <select name="status"
								class="form-control">
								<option value="">所有</option>
								<option value="2"
									<c:if test="${statusValue == 2 }">selected="selected"</c:if>>未开课</option>
								<option value="3"
									<c:if test="${statusValue == 3 }">selected="selected"</c:if>>在读</option>
								<option value="4"
									<c:if test="${statusValue == 4 }">selected="selected"</c:if>>结课</option>
							</select>
						</div>
						<input type="hidden" id="pageNum" name="pageNum" />
						<button type="submit" class="btn btn-default">搜索</button>
					</form>
				</div>
			</div>
		</div>
		<div class="col-md-12">
			<table class="table table-hover table-border">
				<thead>
					<tr>
						<th>班级名称</th>
						<th style="min-width: 6rem">产品名称</th>
						<th style="min-width: 6rem">班级状态</th>
						<th style="min-width: 10rem">预科时间</th>
						<th style="min-width: 10rem">正课时间</th>
						<th style="min-width: 10rem">实训时间</th>
						<th style="min-width: 10rem">毕业时间</th>
						<th style="min-width: 4rem">人数</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<c:if test="${fn:length(pageInfo.list) == 0 }">
						<tr align="center">
							<td colspan="9">没有查询到数据</td>
						</tr>
					</c:if>
					<c:forEach items="${pageInfo.list }" var="item">
						<tr>
							<td><a href="class/info?name=${item.name }"
								data-title="班级详情">${item.name }</a></td>
							<td>${item.product.type.name } ${item.product.name }</td>
							<td><c:choose>
									<c:when test="${2 == item.status }">
										未开课
									</c:when>
									<c:when test="${3 == item.status }">
										在读
									</c:when>
									<c:when test="${4 == item.status }">
										结课
									</c:when>
									<c:otherwise>
										未知状态
									</c:otherwise>
								</c:choose></td>
							<td><fmt:formatDate pattern="yyyy-MM-dd"
									value="${item.preparatoryDate}" /></td>
							<td><fmt:formatDate pattern="yyyy-MM-dd"
									value="${item.openDate}" /></td>
							<td><fmt:formatDate pattern="yyyy-MM-dd"
									value="${item.trainDate}" /></td>
							<td><fmt:formatDate pattern="yyyy-MM-dd"
									value="${item.endDate}" /></td>
							<td>${item.ext1 }</td>
							<td><a
								href="class/edit?name=${item.name }&className=${nameValue }&productId=${productValue }&classStatus=${statusValue }&pageNum=${pageInfo.pageNum }&pageSize=${pageInfo.pageSize }"
								type="button" data-title="编辑班级" class="btn btn-primary btn-sm">
									<span class="glyphicon glyphicon-pencil" aria-hidden="true">
										编辑</span>
							</a></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<c:import url="/WEB-INF/jsp/paging.jsp" />
		</div>
	</div>
</body>
</html>